package acm.usa2006.southcentral;

import java.util.Scanner;
import java.util.Stack;

/*
 * p2577
 * South Central USA 2006
 */

public class p2577 {

	static int n, num;
	static Stack<Integer> st;

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		n = scanner.nextInt();
		for (int i=1;i<=n;++i) {
			num = scanner.nextInt();
			if (num < 10) {
				System.out.println(num);
			}
			else {
				st = new Stack<Integer>();
				int rem = 0;
				while (true) {
					int last = num % 10 + rem;
					if (last >= 5) {
						rem = 1;
					}
					else {
						rem = 0;
					}
					
					num /= 10;
					
					if (num == 0) {
						st.add(last);
						break;
					}
					else {
						st.add(0);
					}
				}
				
				while (!st.isEmpty()) {
					System.out.print(st.pop());
				}
				System.out.println();
			}
		}
		
	}

}
